package vendalenger.debvi.jfx;

import java.io.File;
import java.net.MalformedURLException;

import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.control.Button;
import javafx.scene.control.Tooltip;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Rectangle;
import javafx.scene.shape.Shape;

public class Shortcut {

	public static Button quickButton(String text, EventHandler<ActionEvent> action, String toolTip, String icon) {
		Button rb = new Button(text);
		try {
			rb.setGraphic(new ImageView(new Image(new File(icon).toURI().toURL().toString())));
		} catch (MalformedURLException e) {
			e.printStackTrace();
		}
		rb.setTooltip(new Tooltip(toolTip));
		rb.setOnAction(action);
		return rb;
	}
	
	public static Shape leaf() {
		return Shape.union(new Circle(32), new Rectangle(-32, -32, 32, 32));
	}
}
